<template>
    <h1>个人介绍</h1>
    <div>姓名:{{user.username }}</div>
    <div>年龄:{{user.age }}</div>
    <div>职位:{{user.job }}</div>
    <div>
        <button @click="update('张无忌',23,'教主')">修改信息</button>
        <button @click="patchUserInfo('周芷若',33)">修改部分信息</button>
    </div>
</template>
<script lang='ts' setup>
import {useUserStore} from '@/store/user'
const {user,modifyUserInfo,$patch}=useUserStore()
console.log('user',user);
const update=(username:string,age:number,job:string)=>modifyUserInfo(username,age,job)
const patchUserInfo=(username:string,age:number)=>$patch({
    user:{
        username,
        age
    }
})
</script>
<style lang='scss' scoped>
</style>